home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / compguid / texnfont / iter8txt.sx
Encoding:
Text File  |  1996-05-21  |  478 b   |  17 lines  |  [TEXT/ttxt]

  1. --<<<
  2.  
  3. method getUpperCase self {class String} -> (
  4.     local lowers := new NumberRange lowerBound:97 upperBound:122
  5.     local upperCaser := getFirst "a" - getFirst "A"
  6.     -- make it handle string constants by coercing them to strings
  7.     if self.mutable = false do self := self as String
  8.     local myIterator := iterate self
  9.     repeat while (next myIterator) do (
  10.         if (withinRange lowers myIterator.value) do (
  11.             myIterator.value := myIterator.value - upperCaser
  12.         )
  13.     )
  14.     return self
  15. )
  16.  
  17. -->>>